/**
 * 人才信息 人才信息查看
 */
<template>
    <div>
        <!-- 面包屑导航 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>人才信息</el-breadcrumb-item>
        </el-breadcrumb>
        <!-- 搜索筛选 -->
        <el-form :inline="true" :model="formInline" class="user-search">
            <el-form-item label="搜索：">
                <el-select
                    size="small"
                    v-model="formInline.education"
                    placeholder="学历"
                >
                    <el-option
                        v-for="type in education"
                        :label="type.key"
                        :value="type.value"
                        :key="type.value"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-input
                    size="small"
                    v-model="formInline.startJobTime"
                    placeholder="工作年限"
                ></el-input>
            </el-form-item>
            <el-form-item>
                <el-select
                    size="small"
                    v-model="formInline.salary"
                    placeholder="薪资要求"
                >
                    <el-option
                        v-for="type in salary"
                        :label="type.key"
                        :value="type.value"
                        :key="type.value"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-select
                    size="small"
                    v-model="formInline.sex"
                    placeholder="性别"
                >
                    <el-option
                        v-for="type in sex"
                        :label="type.key"
                        :value="type.value"
                        :key="type.value"
                    ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button
                    size="small"
                    type="primary"
                    icon="el-icon-search"
                    @click="search"
                    >搜索</el-button
                >
            </el-form-item>
        </el-form>
        <!--列表-->
        <el-table
            size="small"
            :data="listData"
            highlight-current-row
            v-loading="loading"
            border
            element-loading-text="拼命加载中"
            style="width: 100%"
        >
            <el-table-column fixed align="center" label="序号" min-width="60">
                <template slot-scope="scope">
                    {{
                        scope.$index +
                        (pageparm.currentPage - 1) * pageparm.pageSize +
                        1
                    }}
                </template>
            </el-table-column>
            <el-table-column
                prop="username"
                align="center"
                label="姓名"
                min-width="120"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                label="性别"
                min-width="120"
                align="center"
                show-overflow-tooltip
            >
                <template slot-scope="scope">
                    <div>{{ scope.row.sex == 1 ? "男" : "女" }}</div>
                </template>
            </el-table-column>
            <el-table-column
                label="学历"
                min-width="120"
                align="center"
                show-overflow-tooltip
            >
                <template slot-scope="scope">
                    <div>{{ scope.row.edu[0].education }}</div>
                </template>
            </el-table-column>
            <el-table-column
                prop="startJobTime"
                align="center"
                label="工作年限"
                min-width="120"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                label="求职意向"
                align="center"
                min-width="120"
                show-overflow-tooltip
            >
                <template slot-scope="scope">
                    <div>{{ scope.row.pjs[0].position }}</div>
                </template>
            </el-table-column>
            <el-table-column
                label="薪资要求"
                align="center"
                min-width="120"
                show-overflow-tooltip
            >
                <template slot-scope="scope">
                    <div>{{ scope.row.pjs[0].treatment }}</div>
                </template>
            </el-table-column>

            <el-table-column
                sortable
                prop="createTime"
                align="center"
                label="创建时间"
                min-width="180"
                show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
                align="center"
                label="操作"
                min-width="250"
                fixed="right"
            >
                <template>
                    <el-button size="mini" type="primary">查看</el-button>
                    <el-button size="mini" type="success">导出</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <Pagination
            v-bind:child-msg="pageparm"
            @callFather="callFather"
        ></Pagination>
        <!-- 编辑界面 -->
        <el-dialog
            :title="title"
            :visible.sync="editFormVisible"
            width="50%"
            @click="closeDialog('editForm')"
        >
        </el-dialog>
    </div>
</template>

<script>
import requet from "@/api/axios.js";
import moment from "moment";
import Pagination from "../../components/Pagination";
export default {
    data() {
        return {
            loading: false, //是显示加载
            editFormVisible: false, //控制编辑页面显示与隐藏
            title: "预览",
            //学历
            education: [
                { key: "学历", value: 0 },
                { key: "小学", value: 1 },
                { key: "中学", value: 2 },
                { key: "中专", value: 3 },
                { key: "大专", value: 4 },
                { key: "大学", value: 5 },
                { key: "研究生", value: 6 },
                { key: "博士", value: 7 },
            ],
            salary: [
                { key: "薪资", value: 0 },
                { key: "1000-2000", value: 1 },
                { key: "2001-4000", value: 2 },
                { key: "4001-6000", value: 3 },
                { key: "6001-8000", value: 4 },
                { key: "8001-10000", value: 5 },
                { key: "10001-15000", value: 6 },
                { key: "15001-20000", value: 7 },
                { key: "20001以上", value: 8 },
            ],
            sex: [
                { key: "性别", value: 0 },
                { key: "男", value: 1 },
                { key: "女", value: 2 },
            ],
            formInline: {
                page: 1,
                limit: 10,
                machineNo: "",
                orderNo: "",
                transId: "",
                payType: 0,
                orderStatus: 0,
                token: localStorage.getItem("logintoken"),
            },
            listData: [], //用户数据
            // 分页参数
            pageparm: {
                currentPage: 1,
                pageSize: 10,
                total: 10,
            },
        };
    },
    // 注册组件
    components: {
        Pagination,
    },
    created() {
        this.getListData(this.pageparm.currentPage, this.pageparm.pageSize);
    },
    methods: {
        getListData(currentPage, pageSize) {
            this.loading = true;
            requet
                .get(
                    `/hkrc/person/getPersonInfoAll?pageNo=${currentPage}&pageSize=${pageSize}`
                )
                .then((res) => {
                    console.log(res.data);
                    this.pageparm.total = res.data.count;
                    res.data.personInfo.forEach((item) => {
                        if (item.createTime) {
                            item.createTime = moment(item.createTime).format(
                                "YYYY-MM-DD hh:mm:ss"
                            );
                        }
                    });
                    this.listData = res.data.personInfo;
                });
            this.loading = false;
        },
        // 分页插件事件
        callFather(parm) {
            this.formInline.page = parm.currentPage;
            this.formInline.limit = parm.pageSize;
            this.getListData(this.pageparm.currentPage, this.pageparm.pageSize);
        },
        // 搜索事件
        search() {},
        //显示编辑界面
        handleEdit(index, row) {
            this.editFormVisible = true;
            this.editForm = row;
        },
        // 编辑、增加页面保存方法
        submitForm(editData) {},
        // 关闭编辑、增加弹出框
        closeDialog(formName) {
            this.editFormVisible = false;
            this.$refs[formName].resetFields();
        },
    },
};
</script>

<style scoped>
.user-search {
    margin-top: 20px;
}
.userRole {
    width: 100%;
}
</style>

 
 

 